import { tableServiceInterface } from "@/common/interface/table.interface";
import {
  $musicSongList,
  $musicSongDelete,
  $musicSongUpdate,
  $musicSongAdd,
  $musicSongDetail,
  $musicSongApproveSubmit,
  $musicSongApproveReback,
  $musicSongApprovePass,
  $musicSongApproveUnpass,
  $musicSongStock,
  $musicSongUnStock,
} from "@/apis/music/song/song";
import {
  musicSongListInterface,
  musicSongUpdateInterface,
  musicSongAddInterface,
} from "@/apis/music/song/song.interface";
export default class MusicScoreService implements tableServiceInterface {
  async getTable(e: musicSongListInterface): Promise<any> {
    return $musicSongList(e);
  }
  deleteMultiple(e: Array<string>): Promise<any> {
    return $musicSongDelete(e);
  }
  edit(e: musicSongUpdateInterface): Promise<any> {
    return $musicSongUpdate(e);
  }
  add(e: musicSongAddInterface): Promise<any> {
    return $musicSongAdd(e);
  }
  detail(id: string): Promise<any> {
    return $musicSongDetail(id);
  }
  // 修改热门状态
  isRecommendChange({ record, isRecommend }: { record: musicSongUpdateInterface, isRecommend: number }): Promise<any> {
    record.isRecommend = isRecommend;
    return $musicSongUpdate(record);
  }
  // 修改启用状态
  statusChange({ record, status }: { record: musicSongUpdateInterface, status: number }): Promise<any> {
    return status === 0 ? $musicSongStock(record.id) : $musicSongUnStock(record.id);
  }
  // 修改是否审核用状态
  toExamineChange({ record, toExamine }: { record: musicSongUpdateInterface, toExamine: number }): Promise<any> {
    record.toExamine = toExamine;
    return $musicSongUpdate(record);
  }
  // 审核提交
  approveSubmit(id: number): Promise<any> {
    return $musicSongApproveSubmit(id);
  }
  // 重新审核提交
  approveReback(id: number): Promise<any> {
    return $musicSongApproveReback(id);
  }
  // 审核通过
  approvePass(id: number): Promise<any> {
    return $musicSongApprovePass(id);
  }
  // 审核不通过
  approveUnpass(id: number): Promise<any> {
    return $musicSongApproveUnpass(id);
  }
}